package com.andy.qi.util;

import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;

/**
 * 配置文件
 * 
 * @author andy
 * 
 */
public class Conf {
	
	private static final ResourceBundle BUNDLE = PropertyResourceBundle.getBundle("application");
	
	public static String get(String name) {
		return BUNDLE.getString(name);
	}
	
	public static int getInt(String name) {
		return getInt(name, 0);
	}
	
	public static int getInt(String name, int defaultValue) {
		String v = get(name);
		if(v == null) {
			return defaultValue;
		}
		return Integer.parseInt(v);
	}
	
	public static boolean getBoolean(String name) {
		return getBoolean(name, false);
	}
	
	public static boolean getBoolean(String name, boolean defaultValue) {
		String v = get(name);
		if(v == null) {
			return defaultValue;
		}
		return Boolean.parseBoolean(v);
	}

}

